#ifndef SIGNALHANDLER_H_
#define SIGNALHANDLER_H_

#include <signal.h>
#include <stdio.h>

#include "EventHandler.h"

class SignalHandler {

	private:

		static SignalHandler instance;
		static EventHandler* signal_handlers [ NSIG ];

		SignalHandler ( void );
		static void dispatcher ( int signum );

	public:

		static SignalHandler& getInstance ();

		/* emitir la senial especificada en nsig al proceso pid */
		static int emitirSenial(int pid, int signum);

		/* bloquear senial especificada en nsig*/
		static void bloquearSenial(int signum);

		static void desbloquearSenial(int signum);

		static void desbloquearTodasSeniales();

		static void bloquearTodasSeniales();

		EventHandler* registrarHandler ( int signum, EventHandler* eh );

		int removerHandler ( int signum );

		EventHandler* getHandler( int signum );

};

#endif /* SIGNALHANDLER_H_ */
